<%@page import="java.util.Random"%>
<%@page import="java.util.Set" %>
<%@page import="java.util.HashSet" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
	
</script>
<style type="text/css">
body {
	background-image: url('../images/cool.gif');
}

button {
	width: 100px;
	height: 30px;
	color: red;
	text-shadow: 5px 5px 5px #FF0000;
}

h3 {
	text-shadow: 5px 5px 5px #FF0000;
	color: #900000;
	font: italic bold 20px serif;
}

p{
	text-align:center;
	text-shadow: 5px 5px 5px #FF0000;
	color: #900000;
 }
h1 {
	text-shadow: 5px 5px 5px #FF0000;
	color: #3333FF;
	font: italic bold 25px serif;
	text-align:center;
}
fieldset {
	text-shadow: 2px 2px 2px #99FF99;
	font: italic bold 12px/30px Georgia, serif;
}
</style>
<script type="text/javascript">

	$(document).ready(function() {
		$("#welcomePage").show();
		$("#infoPage").hide();
		$("#managerPage").hide();
		
		$("#login").click(function() {
			$("#welcomePage").hide();
			$("#infoPage").show();
			$("#managerPage").hide();
		});
		
		$("#A_btn").click(function(){
			var managername = $("#manager").val();
			var password = $("#psd").val();
			
			if(managername == "" || password ==""){
				alert("error,please enter the Info");
				return false;
 			}
			else{
				$.ajax({
					type:"GET",
					url:"/Spring_MVC/manager/vailation.do",
					data:"name="+managername+"&psd="+password,
				
				success:function(msg){
					$("#manager").disable = true;
					$("#psd").disable = true;
					if(msg == "noPeople"){
						alert("sorry, please sign in");
					}
					if(msg == "fail"){
						alert("sorry, error");
					}
					if(msg =="success"){
						parent.document.location.href="/Spring_MVC/manager/all.do";
					}
 				},
				});
				return false;
			}
 		});
		
		
		$("#manager").keyup(function(event){
//			alert(event.target.value);
 			$.ajax({
				type:"GET",
				url : "/Spring_MVC/manager/hit.do",
				data:"str="+event.target.value,
				
				success:function(msg){
		//			alert(msg);
					$("#txtHint").html(msg);
				}
			});
		});
 	});
	
	
	
	
	function logup(){
		$("#welcomePage").hide();
		$("#infoPage").hide();
		$("#managerPage").show();
 	}

	/* 	function myBtn(){
	 } */

	function check() {
		var fname = document.getElementById("fname").value;
		var lname = document.getElementById("lname").value;
		var position = document.getElementById("position").value;
		var phone = document.getElementById("phone").value;
		var email = document.getElementById("email").value;
		var age = document.getElementById("age").value;
		if (fname == "" || lname == "" || position == "" || phone == ""
				|| email == "" || age == "") {
			alert("Please enter the all information");
			return false;
		} else {
			return true;
		}
	}


/* 	function m_check() {
		var manager = document.getElementById("manager").value;
		var psd = document.getElementById("psd").value;
		if (manager.equals("admin") && psd.equals("admin")) {
			return true;
		} else {
			alert("Infomation Error");
			return false;
		}
 */	
 
 
</script>

	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Insert title here</title>
</head>
<body>
	<div id="welcomePage">
	<h1>WELCOME TO INCIDENT REPORTING SYSTEM</h1>
	<a  href="javasript:void(0)"   id="login" ><p>IF YOU ARE USER <p></a>
	<a  href="javasript:void(0)"   id="M" onclick="logup()" ><p>IF YOU ARE MANAGER<p></a>
 </div>
 
<div id="managerPage">
	<form runat="server">
		<fieldset>
			<legend>
				<h3>MANAGER INFO LOGIN</h3>
			</legend>
					MANAGER NAME: <input type="text" id="manager"/><br>
					Suggestions: <span id="txtHint"></span><br>
 					MANAGER PSD: <input type="password" id="psd" /><br>
					<button id="A_btn">Submit</button>
 		</fieldset>
	</form>
</div>

<div id="infoPage">
	<div id=header>
		<div class="logo_img">
			<img src="../images/sa_header.png" width="70" height="70">
			<h3>SA WESTERN REPORTING</h3>
		</div>
	</div>
	<hr>
	<div>
		<div id="page-title" class="clearfix">
			<div class="icon_img">
				<h3>INCIDENT REPORTING FORM</h3>
				<img src="../images/nyt5.gif" width="35" height="35"> <img
					src="../images/nyt1.gif" width="35" height="35"> <img
					src="../images/nyt4.gif" width="35" height="35"> <img
					src="../images/nyt7.gif" width="35" height="35">
			</div>
		</div>
		<!-- /.page-title -->
	</div>
	<hr>
	<div>
		<form action="/Spring_MVC/main/insertPerson.do"
			onsubmit="return check()">
			<fieldset>
				<legend>
					<h3>Roporing People Info:</h3>
				</legend>
				First Name: <input type="text" id="fname" name="fname" /><br>
				Last Name: <input type="text" id="lname" name="lname" /><br>
				Position: <input type="text" id="position" name="position" /><br>
				Contact_phone:<input type="text" id="phone" name="phone" /><br>
				Contact_email:<input type="text" id="email" name="email" /><br>
				Age: <input type="text" id="age" name="age" /><br> Sex: <select
					name="sex">
					<option value="Male">Male</option>
					<option value="Female">Female</option>
				</select><br> 
				<input id="login" type="submit" value="Submit" class="btn" />
 				<input id="reset" type="reset" value="Reset" class="btn" />
			</fieldset>
		</form>

	</div>
</div>
 </body>
</html>